import render from '../../../../hrpub/common/frame/render';

import { high } from 'nc-lightapp-front';
import ApproveDetail from 'uap/common/components/ApproveDetail';
import ApprovalTrans from 'uap/common/components/approvalTrans';
// const { ApproveDetail, ApprovalTrans } = high;

import NewApproveDetail from '../../../../hrpub/common/components/newApproveDetail/index.js';

import tableAct from '../actions/table';

import formAct from '../actions/form';

import ButtonAction from '../actions/btn';

import main from '../actions/main';

import { createPage } from 'nc-lightapp-front';

import Header from '../components/Header';

import OrgSituationAction from '../actions/orgSituation';

import AddCard from '../components/addCard';

import Table from '../components/Table';

import TimeModal from '../components/timeModal';

import FileManager from '../components/Uploader';

import EmptyImg from '../../../../hrpub/common/components/emptyImg';

import BatchAddModal from '../components/BatchAddModal';

import OrgSituationModal from '../components/OrgSituactionModal';

import BatchAddAction from '../actions/batchAdd';

import { getAppPageConfig } from 'src/hrpub/common/utils/utils';

import btn from '../actions/btn';

import './index.less';

import Layout from '../../../../hrpub/common/components/Layout';

import ViewCard from 'src/hrpub/common/components/card-view';
import WpsModal from '../../../../hrpub/common/components/wpsPreModel';
const Homepage = render({
	actions: {
		table: tableAct,
		main: main,
		formAct: formAct,
		batAddAct: BatchAddAction,
		orgSta: OrgSituationAction,
		btnAct: btn
	},
	customData: ''
})(({ props, action, state }, { customData }) => {
	const { search, exam } = props;
	return (
		<div className="salaryAuthority nc-bill-card">
			<Header {...props} btn={action.btnAct} formAct={action.formAct} />
			<div className="enpty" style={{ display: exam.cardMode === true ? 'none' : 'block' }}>
				{exam.refValue.refpk || exam.widget ? (
					<Table {...props} main={action.main} table={action.table} />
				) : (
					<Layout>
						<EmptyImg text={exam.json['gx6008-000022']} />
					</Layout>
				)}
			</div>
			<div className="enpty" style={{ display: exam.cardMode === true ? 'block' : 'none' }}>
				<AddCard
					{...props}
					// main = {action.main}
				/>
			</div>
			<OrgSituationModal {...props} />
			<BatchAddModal {...props} batAddAct={action.batAddAct} formAct={action.formAct} />
			<div style={{ display: 'none' }}>
				{search.NCCreateSearch('query', {
					clickSearchBtn: action.main.toSearch
				})}
			</div>
			{exam.fileManagerModalVisible === true ? (
				<FileManager
					billid={exam.billid}
					json={exam.json}
					onClose={action.main.closeModal('fileManagerModalVisible')}
				/>
			) : null}
			{exam.approveDetail === true ? (
				<ApproveDetail
					show={true}
					close={action.main.closeModal('approveDetail')}
					billtype={exam.billtype}
					billid={exam.billid}
				/>
			) : null}

			<TimeModal {...props} main={action.main} table={action.table} />

			{exam.compositedisplay ? (
				<ApprovalTrans
					title={exam.json['gx6008-000276']} /* 国际化处理： 指派*/
					data={exam.compositedata}
					display={exam.compositedisplay}
					getResult={action.table.batchCommit}
					cancel={action.table.turnOff}
				/>
			) : (
				''
			)}

			 {/* 联查卡片 */}
			 {/* <ViewCard
                    { ...props }
                    onRef ={ 
                        node => exam.nodeRefs.showCardViewRefs = node
                    }
                ></ViewCard> */}
				 <WpsModal
                    {...props}
                    onRef ={ref => exam.nodeRefs.wpsview = ref}
                    appcode={getAppPageConfig().appcode}
                    pk_org={exam.refValue}
                   
                />
		</div>
	);
});

export default createPage({
    billinfo: [
        {
            billtype: 'grid',
            pagecode: getAppPageConfig().appcode,
            bodycode: 'org'
        },
        {
            billtype: 'grid',
            pagecode: getAppPageConfig().appcode,
            bodycode: 'dept'
        },
        {
            billtype: 'grid',
            pagecode: getAppPageConfig().appcode,
            bodycode: 'list'
        },
        {
            billtype: 'grid',
            pagecode: getAppPageConfig().appcode,
            bodycode: 'list_batch'
        },
        {
            billtype: 'extcard',
            pagecode: getAppPageConfig().appcode,
            headcode: 'card',
            bodycode:["psninfo", "oldinfo", "newinfo", "execinfo", "table_end_info", "audit_info"]
        },
        {
            billtype: 'extcard',
            pagecode: getAppPageConfig().pagecode,
            headcode: 'card_batch',
            bodycode:["psninfo_batch", "newinfo_batch", "execinfo_batch", "table_end_info_batch"]
        }]
})(Homepage);
